package com.uzai.console.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.uzai.console.dto.fd.fdfollowedmsg.FdFollowedMsgQuery;
import com.uzai.console.entity.FdFollowedMsg;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;

@Repository
public interface FdFollowedMsgMapper {
    int deleteById(@Param("id") Long id);

    /**
     * 删除多少时间之前的数据
     * @author liuqi
     * @date 2022/6/24 16:55
     * @param beforeDay
     */
    void deleteBeforeDay(@Param("beforeDay") Integer beforeDay);

    int insert(FdFollowedMsg record);

    int insertSelective(FdFollowedMsg record);

    FdFollowedMsg selectById(@Param("id") Long id);

    FdFollowedMsg selectByDeviceUniqueIdAndServerMsgId(@Param("deviceUniqueId") Long deviceUniqueId, @Param("serverMsgId") String serverMsgId);

    int updateByIdSelective(FdFollowedMsg record);

    int updateById(FdFollowedMsg record);

    int updateStatus(FdFollowedMsg record);

    /**
     * 分页查询根据机器人、群、消息发送者分组之后 取第一条
     * @param page
     * @param query
     * @return
     */
    ArrayList<FdFollowedMsg> findByListDistinctDviceAndGroupAndUser(Page<FdFollowedMsg> page, @Param("query") FdFollowedMsgQuery query);


}